package main

import "fmt"

var name = "111"

//错误的方式
//bb:=true
var (
	s   = "1243"
	a   = 1
	abc = 3
)

func variableZeroValue() {
	var a int
	var s string
	fmt.Printf("%d %q\n", a, s)
}

func variableInitialValue() {
	var a, b = 3, 4
	var s = "abcd"
	fmt.Println(a, s, b)
}

func variableTypeDeduction() {
	var a, b, c, s = 3, 4, true, "def"
	fmt.Println(a, b, c, s)
}

func consts() {
	const (
		userName = "alex"
		c, d     = 3, 4
	)
	const fileName = "abc.txt"
	const a, b = 3, 4

}

func enums() {
	const (
		//cpp    = 0
		//java   = 1
		//python = 2
		//golang = 3
		cpp    = iota
		java
		python
		golang
	)

	// b, kb ,mb ,gb ,tb,pb
	const (
		b  = 1 << (10 * iota)
		kb
		mb
		gb
		pb
	)
	fmt.Printf("b = %d,kb = %d,mb = %d,gb = %d ,pb = %d", b, kb, mb, gb, pb)
	fmt.Println()
	fmt.Printf("cpp = %d,java = %d,python = %d,golang = %d", cpp, java, python, golang)
}

func variableShorter() {
	a, b := 3, 4
	s := "abcd"
	fmt.Println(a, s, b)
}

func main() {
	fmt.Println("Hello World!", name)
	variableZeroValue()
	variableInitialValue()
	variableTypeDeduction()
	fmt.Println(s, abc, a)
	enums()
}
